package alo.p10;

/**
 * @ClassName InsertionSort
 * @Description 插入排序
 * @Author Fanxc
 * @DATE 2021/3/11 14:40
 * @Version 1.0
 */
public class InsertionSort {
    void insertionSort(int[] A,int n) {
        int i, j, temp;
        for (i = 1; i < n - 1; i++) {
            for (j = i; A[j - 1] > A[j] && j > 0; j--) {
                temp = A[j];
                A[j] = A[j - 1];
                A[j - 1] = temp;
            }
        }
    }
}
